package com.shuma.product.controller;

import com.alipay.sofa.runtime.api.annotation.SofaReference;
import com.alipay.sofa.runtime.api.annotation.SofaReferenceBinding;
import com.shuma.user.pojo.User;

import com.shuma.user.service.UserProxyRpc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class TestController {

    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/test")
    public String hello() {
//        StpUtil.checkRole("user");  // 角色判断加上这一句就行，代表角色为user才能调用这个接口
        return "hello world!";
    }

//    @SofaReference(interfaceType = UserProxyRpc.class, uniqueId = "${service.unique.id}", binding = @SofaReferenceBinding(bindingType = "bolt"))
//    private UserProxyRpc userProxyRpc;
//
//    @GetMapping("/test1")
//    public void hello1() {
//        User admin = userProxyRpc.search("admin");
//        System.out.println(admin.getEmail());
//    }

}
